<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
<%String path = request.getContextPath();%>
<%@ taglib uri="/WEB-INF/tld/c.tld" prefix="c" %>
<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <title>代扣明细</title>
    <style type="text/css">
    </style>
    <jsp:include page="../../import.jsp" flush="true"/>
    <script type="text/javascript">
        var grid = null;
        var searchOrgTree = null;
        $(function () {
            var _masterIdtmp = parent.pageInApp.masterId;
            var parms = {};
            if(typeof(_masterIdtmp) != "undefined" && _masterIdtmp != ""){
                parms.masterId = _masterIdtmp;
                parent.pageInApp.masterId="";
            }
            $("#ligergrid1").ligerGrid({
                url: '<%=path%>/infside/infPostCollectDetail/initInfPostCollectDetaiList.do',
                parms: parms,
                method : 'get',
                columns: [
                    { display: '代扣类型', name: 'type', minWidth: 100, align: 'center', enabledSort:true},
                    {
                        display: '发送文件',minWidth: 150,align: 'center',
                        render: function (rowdata, rowindex, value){
                            var h1='';
                            if(rowdata.sendFileName!=null){
                                if(rowdata.sendFilePath!=null){
                                    h1='<a href="<%=path%>/infside/infPostCollectMaster/downMasterFile.do?filename='+rowdata.sendFileName+'&filepath='+rowdata.sendFilePath+'">'+rowdata.sendFileName+'</a>';
                                }else{
                                    h1=rowdata.sendFileName;
                                }
                            }
                            return h1;
                        }
                    },
                    { display: '用户号(卡号)', name: 'accId', minWidth: 150, align: 'center', enabledSort:true},
                    { display: '生成日期', name: 'crtTm', minWidth: 100, render:renderDate, align: 'center', enabledSort:true},
                    { display: '客户名称', name: 'customerName', minWidth: 100, align: 'center', enabledSort:true},
                    { display: '证件号码', name: 'paperId', minWidth: 150, align: 'center', enabledSort:true},
                    { display: '交易总金额', name: 'tranAtdou', minWidth: 100, align: 'center', enabledSort:true},
                    { display: '应收租金', name: 'receivableAtdou', minWidth: 100, align: 'center', enabledSort:true},
                    { display: '逾期金额', name: 'overdueAtdou', minWidth: 100, align: 'center', enabledSort:true},
                    { display: '滞纳金', name: 'amountdou', minWidth: 100, align: 'center', enabledSort:true},
                    { display: '应答码', name: 'ansCd', minWidth: 100, align: 'center', enabledSort:true},
                    { display: '应答说明', name: 'ansCdNm', minWidth: 150, align: 'center', enabledSort:true},
                    { display: '可用余额', name: 'accBalAtdou', minWidth: 100, align: 'center', enabledSort:true},
                    { display: '实扣金额', name: 'actAtdou', minWidth: 100, align: 'center', enabledSort:true},
                    { display: '实扣日期', name: 'payDate', minWidth: 100, render:renderDate, align: 'center', enabledSort:true}
                ],
                pageSize:10,
                root:'rows',
                record:'total',
                hideLoadButton : true,
                width: '100%',
                height:380,
                heightDiff:-2,
                //checkbox:true,
                rownumbers:true
            });
            grid = liger.get("ligergrid1");
            $("#searchBar").ligerForm();
            $("#searchBtn").click(function(event) {
                var form = new liger.get("searchBar");
                var data = form.getData();
                console.log(data);
                for (name in data){
                    grid.setParm(name,data[name]);
                };
                grid.setParm("masterId","");
                grid.reload();
            });
            $("#clearBtn").click(function(event) {
                clearLigerForm("searchBar");
            });
        });
        //格式化时间
        function renderDate(rowdata, index, value){
            var dateStr = "";
            if(null != value){
                var date = new Date(value);
                dateStr = DateUtils.formatDate(date, DateUtils.YYYY_MM_DD);
            }
            return dateStr;
        }
        //导出
        function exportCollectDetailExcel(){
            var form = liger.get("searchBar");
            var data = form.getData();
            var req="format=xls";
            for (name in data) {
                for (name in data) {
                    if(data[name]){
                        req+="&"+name+"="+data[name];
                    }
                }
            }
            window.location.href="<%=path%>/infside/infPostCollectDetail/exportCollectDetailExcel.do?"+req;
        }
    </script>
</head>

<body class="iframeBody">
<div class="Wrapper">
    <div class="searchArea">
        <form id="searchBar">
            <div class="fieldset1 clearFix">
                <div class="fieldBox">
                    <div class="label">用户号/卡号</div>
                    <div class="field">
                        <input name="accId" id="accId" type="text" class="ui-textbox" value="">
                    </div>
                </div>
                <div class="fieldBox col_33">
                    <div class="label">生成日期</div>
                    <div class="field">
                        <input name="createDateStr" id="createDateStr" type="text" class="ui-datepicker" value="">
                    </div>
                </div>
                <div class="fieldBox col_33">
                    <div class="label">实扣日期</div>
                    <div class="field">
                        <input name="payDateStr" id="payDateStr" type="text" class="ui-datepicker" value="">
                    </div>
                </div>
                <div class="fieldBox">
                    <div class="label">发送文件名</div>
                    <div class="field">
                        <input name="sendFileName" id="sendFileName" type="text" class="ui-textbox" value="">
                    </div>
                </div>
                <div class="fieldBox">
                    <div class="label">客户名称</div>
                    <div class="field">
                        <input name="customerName" id="customerName" type="text" class="ui-textbox" value="">
                    </div>
                </div>

                <div class="fieldBox">
                    <div class="label">证件号码</div>
                    <div class="field">
                        <input name="paperId" id="paperId" type="text" class="ui-textbox" value="">
                    </div>
                </div>
                <div class="fieldBox">
                    <div class="label">代扣类型</div>
                    <div class="field">
                        <select name="type"  id="type"  disabled="disabled">
                            <option value="  " selected="selected">--请选择--</option>
                            <c:forEach items="${typelist}" var="opt">
                                <option value="${opt.key}">${opt.value}</option>
                            </c:forEach>
                        </select>
                    </div>
                </div>
                <div class="clearFix"></div>
                <div class="btnsBox">
                    <span id="searchBtn" class="sq-button sq-button-hasicon"><i class="sqBtnIco_1"></i>查询</span>
                    <span id="clearBtn" class="sq-button sq-button-hasicon"><i class="sqBtnIco_19"></i>清空</span>
                    <span class="sq-button sq-button-hasicon" onclick="exportCollectDetailExcel()"><i class="sqBtnIco_21"></i>导出</span>
                    <input id="resetBtn" type="reset" value="重置" class="l-button l-button-reset Hide"/>
                </div>
            </div>
        </form>
    </div>
</div>
<div id="ligergrid1" class="sq-grid"></div>
</body>
</html>
